﻿Global.namespace("System.Core.Handler");
// all type of request
System.Core.Handler.RequestType={
    JQuery:'jquery',
    FaceBook:'facebook',
    Opensocial8:'Opensocial8'
};

System.Core.Handler.RequestHandler=function(){};

System.Core.Handler.RequestHandler.get = function(url, param, callback) {
    param = param || {};
    switch (Config.requestType) {
        case System.Core.Handler.RequestType.Opensocial8:
            
            if (!param[gadgets.io.ContentType.CONTENTTYPE]) {
                param[gadgets.io.ContentType.CONTENTTYPE] = gadgets.io.ContentType.TEXT;
            }
            
            gadgets.io.makeRequest(url, callback, param);
            break;
        case System.Core.Handler.RequestType.JQuery:
            $.get(url, param, callback);
            break;
    }
};
System.Core.Handler.RequestHandler.getResponseData = function(responseData) {
    switch (Config.requestType) {
        case System.Core.Handler.RequestType.Opensocial8:
            return responseData.data;
        case System.Core.Handler.RequestType.JQuery:
            return responseData;
    }
};
